<!--项目信息-->
<template>
  <div class='container'>
    <div>
      <el-form :model="formData" ref="formData" label-width="150px">
        <el-row>
          <el-col :span="24" class="text-r">
            <el-button @click="approvalStatusHandel">查看合同审批情况</el-button>
          </el-col>
        </el-row>

        <fieldset class="contain-box">
          <legend class="contain-title">查看项目信息</legend>
          <el-row>
            <el-col :span="8">
              <el-form-item
                  label="流水号:"
                  prop="reAmountCause"
              >
                <el-input
                    placeholder="请输入内容"
                    v-model="formData.CUST_S0_NUMBER.value"
                    :disabled="true"
                >
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item
                  label="受理运营商"
                  prop="reAmountCause"
              >
                <el-select v-model="formData.ORDER_SOURCE_ID.value" placeholder="请选择"
                           :disabled="formData.ORDER_SOURCE_ID.disabled">
                  <el-option
                      v-for="item in formData.ORDER_SOURCE_ID.options"
                      :key="item.attrValue"
                      :label="item.attrValueName"
                      :value="item.attrValue">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item
                  label="商机"
                  prop="reAmountCause"
              >
                <el-input
                    placeholder="请输入内容"
                    v-model="formData.SALE_ID.value"
                    :disabled="true"
                >
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item
                  label="合同编号类型:"
                  prop="reAmountCause"
              >
                <el-select v-model="formData.CONTRACT_NUMBER_TYPE.value" placeholder="请选择">
                  <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                      :disabled="true">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item
                  label="客户名称"
                  prop="reAmountCause"
              >
                <el-input
                    placeholder="请输入内容"
                    v-model="formData.CUST_NAME.value"
                    :disabled="true"
                >
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item
                  label="客户联系人:"

              >
                <el-input
                    placeholder="请输入内容"
                    v-model="formData.CONTACT_NAME.value"
                    :disabled="true"
                >
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item
                  label="客户联系人电话:"
                  prop="reAmountCause"
              >
                <el-input
                    placeholder="请输入内容"
                    v-model="formData.HOME_PHONE.value"
                    :disabled="true"
                >
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item
                  label="客户Email:"
                  prop="reAmountCause"
              >
                <el-input
                    placeholder="请输入内容"
                    v-model="formData.E_MAIL.value"
                    :disabled="true"
                >
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item
                  label="客户传真"
                  prop="reAmountCause"
              >
                <el-input
                    placeholder="请输入内容"
                    v-model="formData.FAX.value"
                    :disabled="true"
                >
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item
                  label="客户地址"
                  prop="reAmountCause"
              >
                <el-input
                    placeholder="请输入内容"
                    v-model="formData.CUST_ADDR.value"
                    :disabled="true"
                >
                  <el-button slot="append" type="primary">查看</el-button>
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item
                  label="合同编码"
                  prop="reAmountCause"
              >
                <el-input @click.native="drawerShow('合同编码')" v-model="data.CONTACT_NAME" readonly>
                  <template slot="append"><i class="el-icon-more"></i></template>
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item
                  label="合同名称"
                  prop="reAmountCause"
              >
                <el-input
                    placeholder="请输入内容"
                    v-model="formData.CONTACT_CD.value"
                    :disabled="true"
                >

                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item
                  label="项目编码"
                  prop="reAmountCause"
              >
                <el-input @click.native="drawerShow('项目编码')" v-model="data.ORDER_PROJECT_NAME" readonly>
                  <template slot="append"><i class="el-icon-more"></i></template>
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item
                  label="项目名称"
                  prop="reAmountCause"
              >
                <el-input
                    placeholder="请输入内容"
                    v-model="formData.PROJECT_NAME.value"
                >

                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item
                  label="项目描述"
                  prop="reAmountCause"
              >
                <el-input
                    placeholder="请输入内容"
                    v-model="formData.BUSS_DESC.value"
                >

                </el-input>
              </el-form-item>
            </el-col>

            <el-col :span="8">
              <el-form-item
                  label="集团客工"
                  prop="reAmountCause"
              >
                <el-input
                    placeholder="请输入内容"
                    v-model="formData.CUST_WORK_NAME.value"
                >

                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item
                  label="集团客工联系电话"
                  prop="reAmountCause"
              >
                <el-input
                    placeholder="请输入内容"
                    v-model="formData.MOBILE_PHONE.value"
                >

                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item
                  label="集团客工邮箱"
                  prop="reAmountCause"
              >
                <el-input
                    placeholder="请输入内容"
                    v-model="formData.E_MAII.value"
                >

                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item
                  label="是否为区县一站服务需求："
                  prop="reAmountCause"
              >
                <el-select v-model="formData.ONE_SUB_FLAG.value" placeholder="请选择">
                  <el-option
                      v-for="item in formData.ONE_SUB_FLAG.options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                      :disabled="true">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item
                  label="客户经理"
                  prop="reAmountCause"
              >
                <el-input @click.native="drawerShow('客户经理')" v-model="data.CUST_MANAGER_NAME" readonly>
                  <template slot="append"><i class="el-icon-more"></i></template>
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item
                  label="项目经理"
                  prop="reAmountCause"
              >

                <el-input @click.native="drawerShow('项目经理')" v-model="data.BUSI_MANAGER_NAME" readonly>
                  <template slot="append"><i class="el-icon-more"></i></template>
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item
                  label="是否捆绑受理网管专家："
                  prop="reAmountCause"
              >

                <el-select v-model="formData.IS_BIND_WGZJ.value" placeholder="请选择">
                  <el-option
                      v-for="item in formData.IS_BIND_WGZJ.options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                      :disabled="true">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item
                  label="备注："
                  prop="reAmountCause"
              >
                <el-input
                    placeholder="请输入内容"
                    type="textarea"
                    v-model="formData.REMARK.value"
                >
                </el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </fieldset>
      </el-form>
      <span slot="footer" class="dialog-footer">
      <div class="text-c">
        <el-button @click="canselHandel">取消</el-button>
        <el-button type="primary" @click="sunmitDialogHandel">确 定</el-button>
      </div>
    </span>
    </div>
    <el-dialog
        :title="titleMsg"
        top="2vh"
        :visible.sync="contractApprovalDialogVisible"
        :close-on-click-modal="false"
        width="70%"
        append-to-body
        @close="contractApprovalHandelClose"
        v-if="contractApprovalDialogVisible"
    >
      <component v-bind:is="approvalStatus" @clickRow="clickRow" :CTOInfo="CTOInfo"></component>
    </el-dialog>
  </div>
</template>

<script>
import contractApproval from '@/components/custorder/pengding/contractApproval';
import proContractEnquiryList from '@/components/custorder/pengding/proContractEnquiryList';
import requestUtil from '@/utils/requestEnc';
import CustOrderService from '@/api/order/CustOrderService';
import OrderService from '@/api/order/OrderService.js';
import orderSevers from '@/api/order/AendFilling';
import {mapState, mapGetters, mapActions} from 'vuex';
import refreshList from '@/mixins/custorder/refreshList';
import custManager from '@/components/custorder/pengding/custManager';
import projectManager from '@/components/custorder/pengding/projectManager';
import projectCode from '@/components/custorder/pengding/projectCode';

export default {
  mixins: [refreshList],
  // import引入的组件需要注入到对象中才能使用
  components: {
    contractApproval,
    proContractEnquiryList,
    custManager,
    projectManager,
    projectCode
  },
  props: {
    ODKInfo: {
      type: Object,
      default: () => {
        return {};
      },
    },
    CTOInfo: {
      type: [Array, Object],
      default: () => {
        return [];
      },
    },

  },
  // 这里存放数据
  data() {
    return {
      optionsArr: [
        {
          value: '0',
          label: '否',
          disabled: false,
        },
        {
          value: '1',
          label: '是',
          disabled: false,
        },

      ],
      data: {
        'CUST_MANAGER_NAME': '',
        'BUSI_MANAGER_NAME': '',
        'CONTACT_NAME': '',
        'ORDER_PROJECT_NAME': ''
      },
      formData: {
        'CUST_S0_NUMBER': {
          type: 'Ipt',
          name: '流水号',
          colId: 'CUST_S0_NUMBER',
          colType: 'C',
          tableName: 'CUSTOMER_ORDER',
          fieldId: 'CUST_S0_NUMBER',
          oldVal: '',
          attrRoleCd: '0',
          value: '',
          id: '14441-141000049',
          disabled: true,
          show: true,
          span: 6,
          isSave: false,
        },

        'ORDER_SOURCE_ID': {
          type: 'Ipt',
          name: '受理运营商',
          colId: 'ORDER_SOURCE_ID',
          colType: 'C',
          tableName: 'CUSTOMER_ORDER',
          fieldId: 'ORDER_SOURCE_ID',
          oldVal: '',
          options: [],
          attrRoleCd: '0',
          value: '',
          id: '14441-141000049',
          disabled: true,
          show: true,
          span: 6,
          isSave: false,
        },
        'SALE_ID': {
          type: 'Ipt',
          name: '商机',
          colId: 'SALE_ID',
          colType: 'C',
          tableName: 'PROD_INST',
          fieldId: 'SALE_ID',
          oldVal: '',
          attrRoleCd: '0',
          value: '',
          id: '14441-141000049',
          disabled: true,
          show: true,
          span: 6,
          isSave: false,
        },
        'CONTRACT_NUMBER_TYPE': {
          type: 'Ipt',
          name: '合同编号类型',
          colId: 'CONTRACT_NUMBER_TYPE',
          colType: 'C',
          tableName: 'CUSTOMER_ORDER',
          fieldId: 'CONTRACT_NUMBER_TYPE',
          oldVal: '',
          attrRoleCd: '0',
          value: '',
          id: '14441-141000049',
          disabled: true,
          show: true,
          span: 6,
          isSave: false,
        },
        'CUST_NAME': {
          type: 'Ipt',
          name: '客户名称',
          colId: 'CUST_NAME',
          colType: 'C',
          tableName: 'CUSTOMER',
          fieldId: 'CUST_NAME',
          oldVal: '',
          attrRoleCd: '0',
          value: '',
          id: '14441-141000049',
          disabled: true,
          show: true,
          span: 6,
          isSave: false,
        },
        'CONTACT_NAME': {
          type: 'Ipt',
          name: '客户联系人',
          colId: 'CONTACT_NAME',
          colType: 'C',
          tableName: 'CUSTOMER',
          fieldId: 'CONTACT_NAME',
          oldVal: '',
          attrRoleCd: '0',
          value: '',
          id: '14441-141000049',
          disabled: true,
          show: true,
          span: 6,
          isSave: false,
        },

        'HOME_PHONE': {
          type: 'Ipt',
          name: '客户联系人电话',
          colId: 'HOME_PHONE',
          colType: 'C',
          tableName: 'CUSTOMER',
          fieldId: 'HOME_PHONE',
          oldVal: '',
          attrRoleCd: '0',
          value: '',
          id: '14441-141000049',
          disabled: true,
          show: true,
          span: 6,
          isSave: false,
        },
        'E_MAIL': {
          type: 'Ipt',
          name: '客户EMAIL',
          colId: 'E-MAIL',
          colType: 'C',
          tableName: 'CUSTOMER',
          fieldId: 'E-MAIL',
          oldVal: '',
          attrRoleCd: '0',
          value: '',
          id: '14441-141000049',
          disabled: true,
          show: true,
          span: 6,
          isSave: false,
        },
        'FAX': {
          type: 'Ipt',
          name: '客户传真',
          colId: 'FAX',
          colType: 'C',
          tableName: 'CUSTOMER',
          fieldId: 'FAX',
          oldVal: '',
          attrRoleCd: '0',
          value: '',
          id: '14441-141000049',
          disabled: true,
          show: true,
          span: 6,
          isSave: false,
        },
        'CUST_ADDR': {
          type: 'Ipt',
          name: '客户地址',
          colId: 'CUST_ADDR',
          colType: 'C',
          tableName: 'CUSTOMER',
          fieldId: 'CUST_ADDR',
          oldVal: '',
          attrRoleCd: '0',
          value: '',
          id: '14441-141000049',
          disabled: true,
          show: true,
          span: 6,
          isSave: false,
        },
        'CONTACT_ID': {
          type: 'Ipt',
          name: '合同编码',
          colId: 'CONTACT_ID',
          colType: 'C',
          tableName: 'CUSTOMER_ORDER',
          fieldId: 'CONTACT_ID',
          oldVal: '',
          attrRoleCd: '0',
          value: '',
          id: '14441-141000049',
          disabled: true,
          show: true,
          span: 6,
          isSave: false,
        },
        'CONTACT_CD': {
          type: 'Ipt',
          name: '合同名称',
          colId: 'CONTACT_CD',
          colType: 'C',
          tableName: 'CUSTOMER_ORDER',
          fieldId: 'CONTACT_CD',
          oldVal: '',
          attrRoleCd: '0',
          value: '',
          id: '14441-141000049',
          disabled: false,
          show: true,
          span: 6,
          isSave: false,
        },
        'ORDER_PROJECT_ID': {
          type: 'Ipt',
          name: '项目编码',
          colId: 'PROJECT_ID',
          colType: 'C',
          tableName: 'CUSTOMER_ORDER',
          fieldId: 'PROJECT_ID',
          oldVal: '',
          attrRoleCd: '0',
          value: '',
          id: '14441-141000049',
          disabled: true,
          show: true,
          span: 6,
          isSave: false,
        },
        'PROJECT_NAME': {
          type: 'Ipt',
          name: '项目名称',
          colId: 'PROJECT_NAME',
          colType: 'C',
          tableName: 'CUSTOMER_ORDER',
          fieldId: 'PROJECT_ID',
          oldVal: '',
          attrRoleCd: '0',
          value: '',
          id: '14441-141000049',
          disabled: true,
          show: true,
          span: 6,
          isSave: false,
        },

        'BUSS_DESC': {
          type: 'Ipt',
          name: '项目描述',
          colId: 'BUSS_DESC',
          colType: 'C',
          tableName: 'CUSTOMER_ORDER',
          fieldId: 'BUSS_DESC',
          oldVal: '',
          attrRoleCd: '0',
          value: '',
          id: '14441-141000049',
          disabled: true,
          show: true,
          span: 6,
          isSave: false,
        },
        'BUSI_MANAGER_ID': {
          type: 'Ipt',
          name: '项目经理',
          colId: 'BUSI_MANAGER_ID',
          colType: 'C',
          tableName: 'PROD_INST',
          fieldId: 'BUSI_MANAGER_ID',
          oldVal: '',
          attrRoleCd: '0',
          value: '',
          id: '14441-141000049',
          disabled: true,
          show: true,
          span: 6,
          isSave: false,
        },

        'CUST_WORK_NAME': {
          type: 'Ipt',
          name: '集团客工',
          colId: 'CUST_WORK_NAME',
          colType: 'C',
          tableName: 'CUST_WORK',
          fieldId: 'CUST_WORK_NAME',
          oldVal: '',
          attrRoleCd: '0',
          value: '',
          id: '14441-141000049',
          disabled: true,
          show: true,
          span: 6,
          isSave: false,
        },
        'MOBILE_PHONE': {
          type: 'Ipt',
          name: '集团客工联系电话',
          colId: 'MOBILE_PHONE',
          colType: 'C',
          tableName: 'CUST_WORK',
          fieldId: 'MOBILE_PHONE',
          oldVal: '',
          attrRoleCd: '0',
          value: '',
          id: '14441-141000049',
          disabled: true,
          show: true,
          span: 6,
          isSave: false,
        },
        'E_MAII': {
          type: 'Ipt',
          name: '集团客工邮箱',
          colId: 'E_MAII',
          colType: 'C',
          tableName: 'CUST_WORK',
          fieldId: 'E_MAII',
          oldVal: '',
          attrRoleCd: '0',
          value: '',
          id: '14441-141000049',
          disabled: true,
          show: true,
          span: 6,
          isSave: false,
        },
        'ONE_SUB_FLAG': {
          name: '是否为区县一站服务需求',
          type: 'select',
          tableName: 'CUSTOMER_ORDER',
          fieldId: 'ONE_SUB_FLAG',
          colId: 'ONE_SUB_FLAG',
          colType: 'C',
          value: '0',
          options: [
            {label: '否', value: '0'},
            {label: '是', value: '1'}],
          required: true,
          show: true,
          span: 6,
          isSave: false,
        },

        'CUST_MANAGER_ID': {
          type: 'Ipt',
          name: '客户经理',
          colId: 'CUST_MANAGER_ID',
          colType: 'C',
          tableName: 'PROD_INST',
          fieldId: 'CUST_MANAGER_ID',
          oldVal: '',
          attrRoleCd: '0',
          value: '',
          id: '14441-141000049',
          disabled: true,
          show: true,
          span: 6,
          isSave: false,
        },

        'IS_BIND_WGZJ': {
          type: 'Ipt',
          name: '是否捆绑受理网管专家',
          colId: 'IS_BIND_WGZJ',
          colType: 'C',
          tableName: 'CUSTOMER_ORDER',
          fieldId: 'IS_BIND_WGZJ',
          options: [
            {label: '否', value: '0'},
            {label: '是', value: '1'}],
          oldVal: '',
          attrRoleCd: '0',
          value: '',
          id: '14441-141000049',
          disabled: true,
          show: true,
          span: 6,
          isSave: false,
        },
        'REMARK': {
          type: 'Ipt',
          name: '备注',
          colId: 'REMARK',
          colType: 'C',
          tableName: 'CUSTOMER_ORDER',
          fieldId: 'REMARK',
          oldVal: '',
          attrRoleCd: '0',
          value: '',
          id: '14441-141000049',
          disabled: true,
          show: true,
          span: 6,
          isSave: false,
        },
      },
      contractApprovalDialogVisible: false,
      orderItemIds: '',
      newCTOInfo: [],
      orderTask: {},
      reAmountCause: '',
      value: '',
      //
      approvalStatus: '',
      dataArr: [
        {
          // 流水号
          '202106-221': {
            fieldId: 'LOOP_MONEY',
            tableName: 'PROD_OFFER_FEE_INFO',
            colId: 'AMOUNT',//对应的字段
            coltype: 'C',
            value: '0',
            option: [],
            id: '202106-221',
            attrRoleCd: '100',
            acctItemId: '3002000',
            relIds:
                '41000010;100012610;100010009;100011534;100011056;100011694;100012993;100010007;100010008;100012516;100012632;100012493;100012494;100013123;100013131;100010191;100010006;100013166',
          },
        },
      ],
      options: [
        {
          value: '142002138001',
          label: 'MSS合同编号',
        },
        {
          value: '142002138002',
          label: 'MSS合同发起号',
        },
        {
          value: '142002138003',
          label: '无合同立项的项目号',
        },
        {
          value: '142002138004',
          label: '测试合同编号',
        },
        {
          value: '142002138005',
          label: '公免合同编号',
        },
        {
          value: '142002138006',
          label: '三联单合同号',
        },
      ],
      // 弹窗标题
      titleMsg: '',
      customer: {},
      prodInst: {},
      orderContactInfo: {},
      custManagerTablePage: {
        pageIndex: 1,
        pageSize: 10,
        rowCount: 0,
        pageCount: 0,
      },
      proManagerTablePage: {
        pageIndex: 1,
        pageSize: 10,
        rowCount: 0,
        pageCount: 0,
      },
    };
  },
  // 生命周期 - 创建完成（可以访问当前this实例）
  created() {
    
    
  },
  async mounted() {
    //  受理运营商接口联调
    let params = {attrId: '100010765', productId: ''};
    this.getAttrValueList(params);
    
    if (this.CTOInfo instanceof Array) {
      this.newCTOInfo = this.CTOInfo;
    } else {
      this.newCTOInfo = [this.CTOInfo];
    }

    var orderItemIds = '';
    var scopeInfos = [];

    scopeInfos.push({scope: 'customerOrders'});
    scopeInfos.push({scope: 'ordProdInsts'});
    scopeInfos.push({scope: 'orderContactInfos'});
    scopeInfos.push({scope: 'orderItemAudits'});

    var custSoNumber = this.newCTOInfo[0].custSoNumber;
    var batchNbr = this.newCTOInfo[0].batchNbr;
    var custId = this.newCTOInfo[0].custId;
    var taskId = this.newCTOInfo[0].taskId;

    this.orderItemIds = orderItemIds;
    const orderDetailOrders = await CustOrderService.qryCustomerOrderDetail(
        {custSoNumber, batchNbr, custId, scopeInfos});
    const res = orderDetailOrders.orderDetails[0];
    
    var orderContactInfos = res.orderContactInfos.filter(item =>{return item.orderItemId == -1});
    var orderContactInfo = orderContactInfos[0];
    this.orderContactInfo = orderContactInfos[0];
    
    var customer =  res.customerOrders;
    this.customer = customer[0];
    var prodInsts = res.ordProdInsts;
    var prodInst = prodInsts.filter((item) => {return item.roleCd == '0';});
    this.prodInst = prodInst[0];

    
    

    // 流水号
    this.formData.CUST_S0_NUMBER.value = res.customerOrders[0].custSoNumber;
    this.formData.ORDER_SOURCE_ID.value = res.customerOrders[0].orderSourceId;
    this.formData.CONTRACT_NUMBER_TYPE.value = res.customerOrders[0].contractNumberType;
    this.formData.CUST_NAME.value = res.customerOrders[0].custName;
    
    this.formData.CONTACT_NAME.value = orderContactInfo.contactName;
    this.formData.HOME_PHONE.value = orderContactInfo.officePhone;
    this.formData.E_MAIL.value = orderContactInfo.contactEmail;
    this.formData.FAX.value = orderContactInfo.fax;
    this.formData.CUST_ADDR.value = customer[0].contactAddress;
    this.formData.CONTACT_ID.value = res.customerOrders[0].contactCd;
    this.data.CONTACT_NAME = res.customerOrders[0].contactCd;
    this.formData.CONTACT_CD.value = res.customerOrders[0].contactName;
    this.formData.BUSS_DESC.value = res.customerOrders[0].bussDesc;
    this.formData.ONE_SUB_FLAG.value = res.customerOrders[0].ongSubFlag;
    this.formData.IS_BIND_WGZJ.value = res.customerOrders[0].isBindWgzj;
    this.formData.REMARK.value = res.customerOrders[0].remark;
    this.formData.SALE_ID.value = prodInst[0].saleId;
    this.formData.ORDER_PROJECT_ID.value = customer[0].projectId;
    this.formData.PROJECT_NAME.value = customer[0].projectName;
    this.data.ORDER_PROJECT_NAME = customer[0].projectId;
    this.formData.BUSI_MANAGER_ID.value = prodInst[0].busiManagerId;
    this.formData.CUST_MANAGER_ID.value = prodInst[0].custManagerId;

    // this.getCustManagerList();
    // this.getProManagerList();

    // 集团客工
    // this.formData.CUST_WORK_NAME.value=res.customerOrders[0].custWorkName;
    // 集团客工联系电话
    // this.formData.MOBILE_PHONE.value=res.customerOrders[0].mobilePhone;
    //  集团客工邮箱
    // this.formData.E_MAII.value=res.customerOrders[0].email;

    // 2021080203
    var sqlParam = {
     "interFaceType":"ORDER",
      "sqlId":"2021080203",
      "paramStr": "staffId:"+this.formData.BUSI_MANAGER_ID.value
    }
    var result = await OrderService.executeSql(sqlParam);
    
    var rtnMsg = result.meta.resList.executeSqlResps[0];
    this.data.BUSI_MANAGER_NAME = rtnMsg.staff_name;

 var sqlParam = {
     "interFaceType":"ORDER",
      "sqlId":"2021080203",
      "paramStr": "staffId:"+ prodInst[0].custManagerId
    }
    var result = await OrderService.executeSql(sqlParam);
    
    var rtnMsg = result.meta.resList.executeSqlResps[0];
    this.data.CUST_MANAGER_NAME = rtnMsg.staff_name;

  },
  // 方法集合
  methods: {
    // 客户经理
    async getCustManagerList() {
      let that = this;
      let params = {
        'orgId': this.user.orgId,//ssion里取
        'postCode': '014_KHJL',//客户经理  014_KHJL    业务经理  016_XMJLYWJL
        'pageIndex': this.custManagerTablePage.pageIndex,
        'pageSize': this.custManagerTablePage.pageSize,
        'staffId':that.formData.CUST_MANAGER_ID.value
      };
      var result = await orderSevers.qryStaffList(params);
      
      let res = result.meta.staffIdList;

      res.forEach(function(elem) {
        

        if (that.formData.CUST_MANAGER_ID.value === elem.staffId) {
          that.data.CUST_MANAGER_NAME = elem.staffName;
        }
      });

    },
    // 项目经理
    async getProManagerList() {
      let that = this;
      let params = {
        'orgId': this.user.orgId,//ssion里取
        'postCode': '016_XMJLYWJL',//客户经理  014_KHJL    业务经理  016_XMJLYWJL
        'pageIndex': this.proManagerTablePage.pageIndex,
        'pageSize': this.proManagerTablePage.pageSize,
        'staffId':that.formData.BUSI_MANAGER_ID.value
      };
      var result = await orderSevers.qryStaffList(params);

      let res = result.meta.staffIdList;
      res.forEach(function(elem) {
        if (that.formData.BUSI_MANAGER_ID.value === elem.staffId) {
          that.data.BUSI_MANAGER_NAME = elem.staffName;
        }
      });
    },

    // 显示弹窗
    drawerShow(val) {
      
      
      this.contractApprovalDialogVisible = true;
      switch (val) {
        case '合同编码':
          this.titleMsg = '合同查询列表';
          // this.approvalStatus = '';
          this.approvalStatus = proContractEnquiryList;
          break;
        case '客户经理':
          this.titleMsg = '客户经理查询列表';
          // this.approvalStatus = '';
          this.approvalStatus = custManager;
          break;
        case '项目经理':
          this.titleMsg = '项目经理查询列表';
          // this.approvalStatus = '';
          this.approvalStatus = projectManager;
          break;
        case '项目编码':
          this.titleMsg = '项目信息列表';
          // this.approvalStatus = '';
          this.approvalStatus = projectCode;
          break;
        default:
          break;
      }
    },

    sunmitDialogHandel() {
      this.saveOrderTask();
    },
    canselHandel() {
      this.$emit('update:show', false);
      // 
    },
    // 查看合同审批情况
    approvalStatusHandel() {
      this.titleMsg = '查询合同审批情况';
      this.contractApprovalDialogVisible = true;
      this.approvalStatus = '';
      this.approvalStatus = contractApproval;
    },
    //受理运营商
    async getAttrValueList(params) {
      //获取页面下拉框值
      const result = await OrderService.getAttrValueList(params);
      if (result.code == 200) {
        let attrValueList = result.meta.attrValueList;
        this.formData.ORDER_SOURCE_ID.options = [...attrValueList];
        
      }
    },
    // 关闭弹窗
    contractApprovalHandelClose() {
      this.contractApprovalDialogVisible = false;
      this.approvalStatus = '';
    },
    // 保存
    async saveOrderTask() {
      var param = {
        'custId': this.CTOInfo.custId,
        'custSoNumber': this.CTOInfo.custSoNumber,
        'customerOrders': [
          {
            'actType': 'MOD',
            'custOrderId': this.customer.custOrderId,
            'custId': this.CTOInfo.custId,
            'custSoNumber': this.formData['CUST_S0_NUMBER'].value,
            'orderSourceId': this.formData['ORDER_SOURCE_ID'].value,
            'contractNumberType': this.formData['CONTRACT_NUMBER_TYPE'].value,
            'ongSubFlag': this.formData['ONE_SUB_FLAG'].value,
            'remark': this.formData['REMARK'].value,
            'bussDesc': this.formData['BUSS_DESC'].value,
            'projectName': this.formData['PROJECT_NAME'].value,
            'projectId': this.formData['ORDER_PROJECT_ID'].value,
            'contactCd': this.formData['CONTACT_ID'].value,
            'contactName':this.formData['CONTACT_CD'].value
  
          }],
        'ordProdInsts': [
          {
            'actType': 'MOD',
            'custId': this.CTOInfo.custId,
            'roleCd': '0',
            'prodInstId': this.prodInst.prodInstId,
            'rowId': this.prodInst.rowId,
            'saleId': this.formData['SALE_ID'].value,
            'busiManagerId': this.formData['BUSI_MANAGER_ID'].value,
            'custManagerId': this.formData['CUST_MANAGER_ID'].value,
            'busiManagerId': this.formData['BUSI_MANAGER_ID'].value,
            'isBindWgzj': this.formData['IS_BIND_WGZJ'].value
          },
        ],
        'orderContactInfo': [
          {
            'actType': 'MOD',
            'custId': this.CTOInfo.custId,
            'orderContactInfoId': this.orderContactInfo.orderContactInfoId,
            'custName': this.formData['CUST_NAME'].value,
            'officePhone': this.formData['HOME_PHONE'].value,
            'contactEmail': this.formData['E_MAIL'].value,
            'fax': this.formData['FAX'].value,
            'contactAddress': this.formData['CUST_ADDR'].value,

          },
        ],
      };
      
      var result = await orderSevers.saveCommonOrder(param);
      if (result.code == 200) {
        if (result.meta.resultCode == '0') {
           this.$message({
              type: "success",
              message: "保存成功",
            });
          this.$emit('update:show', false);
        }else{
          this.$message({
              type: "error",
              message: "保存失败",
            });
        }
      }
    },
    // 客户经理-点击表格行事件
    clickRow(selectVal) {
      
      
      this.contractApprovalDialogVisible = false;
      switch (selectVal.name) {
        case '客户经理':
          this.formData['CUST_MANAGER_ID'].value = selectVal.staffId;
          this.data.CUST_MANAGER_NAME = selectVal.staffName;
          break;
        case '项目经理':
          this.data.BUSI_MANAGER_NAME = selectVal.staffName;
          this.formData['BUSI_MANAGER_ID'].value = selectVal.staffId;
          break;
        case '合同编码':
          this.data.CONTACT_NAME = selectVal.staffId;
          this.formData['CONTACT_ID'].value = selectVal.staffId;
          this.formData['CONTACT_CD'].value = selectVal.staffName;
          break;
        case '项目编码':
          this.data.ORDER_PROJECT_NAME = selectVal.staffCode;
          this.formData['ORDER_PROJECT_ID'].value = selectVal.staffCode;
          this.formData['PROJECT_NAME'].value = selectVal.staffName;
          break;
        default:
          break;
      }
    },
  },
  // 监听属性 类似于data概念
  computed: {
    ...mapState('user', ['user']),
  },
  // 监控data中的数据变化
  watch: {},
  // 如果页面有keep-alive缓存功能，这个函数会触发
  activated() {},
  // 生命周期 - 挂载完成（可以访问DOM元素）
  beforeCreate() {},
  // 生命周期 - 数据挂载之前
  beforeMount() {},
  // 生命周期 - 数据更新之前
  beforeUpdate() {},
  // 生命周期 - 数据更新之后
  updated() {},
  // 生命周期 - 页面销毁之前
  beforeDestroy() {},
  // 生命周期 - 页面销毁完成
  destroyed() {},
};
</script>

<style scoped>
/* @import url(); 引入公共css类 */
.contain-box {
  padding: 0.2rem;
  border: 1px solid #f56f3c;
}

.contain-title {
  margin-left: 0.4rem;
  padding: 0 0.1rem;
}

.radioBtn {
  padding-left: 0.2rem;
}

.el-alert {
  margin-bottom: 0.1rem;
}

.text-c {
  text-align: center;
  margin: 0.2rem 0;

}

.text-r {
  text-align: right;
}

.el-dialog__body {
  padding: 0 0.2rem;
}

.el-select {
  width: 100%;
}
</style>
